ci: add a Linux aarch64 build - #331
Conversation
There is no rust-linux-aarch64.yml template yet (libretro/libretro-super#2030) and the rust build image is amd64-only, so this cross-compiles from that image the same way it already cross-compiles the Apple and Android arm64 targets: add the target, the cross linker via CARGO_TARGET_*_LINKER, and an aarch64 strip. before_script inlines the rustup target add rather than extending .rust-target-install, since the cross linker has to be apt-installed in the same block; the toolchain-pin handling from the #91899 post-mortem is unchanged.
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Thanks for a genuinely excellent PR, @WizzardSK — the write-up, the upstream-gap issue (libretro/libretro-super#2030), and the fact that you read the #91899 post-mortem before touching the toolchain all show. Adopted. Verified the job against the actual upstream template (
Closed the gap you flagged ("built natively, couldn't test the cross-compile from x86_64"): Companion PR #334 (now merged) adds One correction to my earlier note, plus a finding worth passing back to you — both from getting #334 green. I'd first assumed the gate needed no header provisioning (a local The relevant bit for your job: that BINDGEN_EXTRA_CLANG_ARGS_aarch64_unknown_linux_gnu: "-isystem /usr/aarch64-linux-gnu/include"(additive — harmless if the image already resolves them). Flagging it so it's a known quantity rather than a surprise; this repo treats the buildbot as observe-post-merge-and-fix-fast, so we'll watch that leg. On the aside: the Merging now — thanks again for a model contribution. |
PR #331 adds a `libretro-build-linux-aarch64` job to the GitLab buildbot recipe, but a GitHub PR cannot run GitLab pipelines, so that cross-compile had zero pre-merge CI coverage -- the exact blind spot the `libretro-cross` gate exists to close (added after buildbot pipeline #91899 failed 9/10 jobs on issues reproducible in seconds on a GH runner). Add `aarch64-unknown-linux-gnu` to the gate's matrix with a per-target provisioning step. bindgen parses `libretro.h` under `--target aarch64`, glibc's `stdint.h` pulls in the arch-split `bits/libc-header-start.h`, and a stock x86_64 runner ships that header only for x86_64 -- so clang fails with `bits/libc-header-start.h not found` (the same Debian-multiarch miss the matrix note already documents for the excluded Apple targets). Installing `gcc-aarch64-linux-gnu` lands `libc6-dev-arm64-cross` under `/usr/aarch64-linux-gnu/include`; `--sysroot` plus an explicit `-isystem` send bindgen there. Still `cargo check` only -- the cross linker that package also provides is unused (linking is the buildbot's job). The header requirement was surfaced by this gate itself: the aarch64 leg failed on the runner with exactly that error, even though a local `cargo check --target aarch64-unknown-linux-gnu` had passed -- because an Arch dev host's glibc headers are not arch-split while the Debian-multiarch runner's are. That divergence is precisely the blind spot the gate exists to catch, now caught pre-merge instead of on the buildbot. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
#334) PR #331 adds a `libretro-build-linux-aarch64` job to the GitLab buildbot recipe, but a GitHub PR cannot run GitLab pipelines, so that cross-compile had zero pre-merge CI coverage -- the exact blind spot the `libretro-cross` gate exists to close (added after buildbot pipeline #91899 failed 9/10 jobs on issues reproducible in seconds on a GH runner). Add `aarch64-unknown-linux-gnu` to the gate's matrix with a per-target provisioning step. bindgen parses `libretro.h` under `--target aarch64`, glibc's `stdint.h` pulls in the arch-split `bits/libc-header-start.h`, and a stock x86_64 runner ships that header only for x86_64 -- so clang fails with `bits/libc-header-start.h not found` (the same Debian-multiarch miss the matrix note already documents for the excluded Apple targets). Installing `gcc-aarch64-linux-gnu` lands `libc6-dev-arm64-cross` under `/usr/aarch64-linux-gnu/include`; `--sysroot` plus an explicit `-isystem` send bindgen there. Still `cargo check` only -- the cross linker that package also provides is unused (linking is the buildbot's job). The header requirement was surfaced by this gate itself: the aarch64 leg failed on the runner with exactly that error, even though a local `cargo check --target aarch64-unknown-linux-gnu` had passed -- because an Arch dev host's glibc headers are not arch-split while the Debian-multiarch runner's are. That divergence is precisely the blind spot the gate exists to catch, now caught pre-merge instead of on the buildbot. Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
Adds a
libretro-build-linux-aarch64job so the core lands innightly/linux/aarch64/on the buildbot, where it is currently missing.Why it is not a one-liner
There is no
rust-linux-aarch64.ymltemplate in ci-templates — onlyrust-linux-x64.yml— andlibretro-build-rustisFROM libretro-build-amd64-ubuntu, so there is no native aarch64 image to point at either. I raised that gap as libretro/libretro-super#2030.So this job cross-compiles from the same image the x64 job already uses, in the style that image already uses for its other arm64 targets (
CARGO_TARGET_AARCH64_APPLE_DARWIN_LINKERand friends): add the target, pointCARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKERataarch64-linux-gnu-gcc, and overrideSTRIP, since the template's defaultstripis host binutils (rust-webos.ymldoes the same for its ARM targets)..libretro-rust-linux-x64is extended rather than-default, since that is what pinsTARGET_ARCHto x86_64.I read the #91899 post-mortem before writing this. The job declares
RUST_TARGETlike every other one and runsrustup target add ${RUST_TARGET}, so therust-toolchain.tomlpin gets itsrust-stdfor aarch64 the same way; it spells thebefore_scriptout rather than extending.rust-target-installonly because the cross linker has to be apt-installed in the same block. Nothing is added totargetsinrust-toolchain.toml, per the note there.If a
rust-linux-aarch64.ymltemplate ever lands, this job collapses to anextends:line.Tested on real aarch64 hardware
Built and run natively on an aarch64 Linux machine (Snapdragon 7c / SC7180, postmarketOS), target
aarch64-unknown-linux-gnu. Worth noting for the pin: rustup honouredrust-toolchain.tomland pulled a fresh 1.96.0 aarch64 toolchain on its own, and the build was clean on it.cargo build --release --target aarch64-unknown-linux-gnuis clean across all the workspace crates (cpu, ppu, apu, mappers, core, libretro)librustynes.so, ELF 64-bit LSB shared object, ARM aarch64, 1.9 MBOne aside, unrelated to this PR: the core cannot be driven by a minimal libretro host that calls
retro_set_environmentbeforeretro_init.rust-libretro0.3.2 panics there withretro_set_environment: Core has not been initialized yet!(rust-libretro-0.3.2/src/lib.rs:432). RetroArch happens to call them in the other order so it never trips, but a stricter frontend would. That is upstreamrust-libretro, not this repo — flagging it only because it cost me a confusing crash while benchmarking.What I could not test: I built natively on aarch64, whereas this job cross-compiles from x86_64. I also cannot run GitLab pipelines from a GitHub PR, so the job itself has not been executed by CI yet.
Summary by CodeRabbit
aarch64-unknown-linux-gnu, enabling support for ARM64 environments.